# -*- coding = utf-8 -*-
# @Time :2024/1/31 12:03
# @Author :invictusQAQ
# @Description :
# @File :  load_excel.py

import openpyxl


def load_excel(file_path, num_columns):
    workbook = openpyxl.load_workbook(file_path)
    sheet = workbook.active

    rows = sheet.max_row
    cols = sheet.max_column

    result = []

    for row in range(1, rows+1):
        # 读取指定数量的列数据
        row_data = tuple(sheet.cell(row=row, column=col).value for col in range(1, num_columns + 1))
        # 将行数据添加到结果列表中
        result.append(row_data)

    workbook.close()
    return result


